package com.wx.exception;

import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ResponseBody;
@Component
@ControllerAdvice
public class ExceptionHandler {
    @org.springframework.web.bind.annotation.ExceptionHandler(Exception.class)
    @ResponseBody
    public Exception exceptionHanderler(Exception ex){
        // 打印堆栈跟踪信息到控制台
        ex.printStackTrace();
        return ex;
    }
}
